from typing import List


class Solution:
    def generate(self, numRows: int) -> List[List[int]]:
        result = []
        for k in range(numRows):
            if k <= 1:
                result.append([1]*(k+1))
                continue
            s = [1]
            for i in range(1,k):
                s.append(result[-1][i-1]+result[-1][i])
            s.append(1)
            result.append(s)
        
        return result
    

if __name__ == "__main__":
    s = Solution()
    r = s.generate(5)
    print(r)